<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/common/taglibs.jsp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Map常量管理</title>
    <%@ include file="/common/meta.jsp" %>
    <%@ include file="/common/public_input.jsp" %>
    <%@ include file="/common/public.jsp" %>

    <script type="text/javascript" src="${ctx}/js/validate/jquery.validate.js"></script>
    <script type="text/javascript" src="${ctx}/js/validate/messages_cn.js"></script>
    <script>
        $(document).ready(function () {

            /* $("#inputForm").validate({
             onsubmit: true,
             rules: {
             name:{
             required:true,
             maxlength:50
             },
             code:{
             required:true,
             maxlength:100
             }
             },
             messages: {
             name:{
             remote:'名称已存在'
             },
             code:{
             remote:'编码已存在'
             }
             }
             });*/
        });

        function elementAddHandler(obj, inputName) {
            var divObj = $("<div><input name='" + inputName + "' type='text' ><input type='button' value='del' onclick='elementDelHandler(this)' ></div>");
            obj.parentNode.parentNode.appendChild(divObj[0])
        }
        function elementDelHandler(obj) {
            obj.parentNode.parentNode.removeChild(obj.parentNode);
        }
    </script>
</head>

<body>
<div class="div-tabs-nav">
    <ul class="ui-tabs-nav">
        <li class="ui-tabs-selected"><s:if test="id!=0">节目修改</s:if><s:else>节目创建</s:else></li>
    </ul>
</div>

<div class="ui-tabs-panel">
    <form id="inputForm" action="${ctx}/program/program/save.action" method="post">
        <div id="message"><s:actionmessage theme="custom" cssClass="success"/></div>
        <input type="hidden" name="entity.id" value="${entity.id}"/>
        <table>
            <tr>
                <td>频道名称：</td>
                <td>
                    <input type="hidden" name="entity.fatherId" value="${entity.fatherId}" />
                    <s:iterator value="channelList" id="element" >
                        <s:if test="#element.id == entity.fatherId">
                            <s:property value="#element.getName()"/>
                        </s:if>
                    </s:iterator>
                </td>
                <td></td>
            </tr>
            <tr>
                <td>节目名称：</td>
                <td>
                    <s:if test="entity.id > 0">
                        <input type="hidden" name="entity.pname" value="${entity.pname}" />
                        <s:property value="entity.pname"/>
                    </s:if>
                    <s:else>
                        <input type="text" name="entity.pname" />
                    </s:else>
                </td>
                <td></td>
            </tr>
            <tr>
                <td>开始时间：</td>
                <td>
                    <s:if test="entity.id > 0">
                        <s:property value="entity.startPlayTime"/>
                        <input type="hidden" name="entity.startPlayTime" value="${entity.startPlayTime}" />
                    </s:if>
                    <s:else>
                        <input type="text" name="entity.startPlayTime" />
                    </s:else>
                </td>
                <td></td>
            </tr>
            <tr>
                <td>结束时间：</td>
                <td>
                    <s:if test="entity.id > 0">
                        <input type="hidden" name="entity.endPlayTime" value="${entity.endPlayTime}" />
                        <s:property value="entity.endPlayTime"/>
                    </s:if>
                    <s:else>
                        <input type="text" name="entity.endPlayTime" />
                    </s:else>
                </td>
                <td></td>
            </tr>
            <tr>
                <td>节目类型：</td>
                <td><s:select cssClass="qsbox" name="entity.type"
                              list="@com.iqiyi.pps.epg.core.model.program.ProgramData@LIVE_PROGRAM_TYPE_MAP" key="entity.type"
                              /></td>
                <td></td>
            </tr>
            <tr>
                <td>付费状态：</td>
                <td><s:radio list="#{'true':'免费','false':'收费'}" name="entity.memberFree" value="entity.memberFree" /></td>
                <td></td>
            </tr>
            <tr>
                <td>会员限制：</td>
                <td><s:radio list="#{'true':'是','false':'否'}" name="entity.memberOnly" value="entity.memberOnly" /></td>
                <td></td>
            </tr>
            <tr>
                <td vAlign="top">节目简介：</td>
                <td colspan="2"><s:textarea style="width:300px;height:80px"
                                            name="entity.description" value="%{entity.description}" ></s:textarea></td>
            </tr>
            <tr>
                <td vAlign="top">主要成员：</td>
                <td>
                    <div style="overflow-y:scroll;height:80px;">
                        <div><input name="entity_member" type="text"><input type="button" value="add"
                                                                            onclick="elementAddHandler(this,'entity_member')">
                        </div>
                        <s:if test="entity.relationList !=null">
                            <s:iterator value="entity.relationList" id="element">
                                <s:if test="#element.type==1">
                                    <div><input name="entity_member" type="text"
                                                value="<s:property value="#element.key+':'+#element.value"/>"><input
                                            type="button" value="del" onclick="elementDelHandler(this)"></div>
                                </s:if>
                            </s:iterator>
                        </s:if>
                    </div>
                </td>
                <td vAlign="top">例 111：刘德华</td>
            </tr>
            <tr>
                <td vAlign="top">关联精彩节目播单：</td>
                <td>
                    <div style="overflow-y:scroll;height:80px;">
                        <div><input name="entity_exciting_programList" type="text"><input type="button" value="add"
                                                                                          onclick="elementAddHandler(this,'entity_exciting_programList')">
                        </div>
                        <s:if test="entity.relationList !=null">
                            <s:iterator value="entity.relationList" id="element">
                                <s:if test="#element.type==2">
                                    <div><input name="entity_exciting_programList" type="text"
                                                value="<s:property value="#element.key"/>"><input
                                            type="button" value="del" onclick="elementDelHandler(this)"></div>
                                </s:if>
                            </s:iterator>
                        </s:if>
                    </div>
                </td>
                <td vAlign="top">例 111</td>
            </tr>
            <tr>
                <td vAlign="top">参赛队伍和比分：</td>
                <td>
                    <div style="overflow-y:scroll;height:80px;">
                        <div><input name="entity_team" type="text"><input type="button" value="add"
                                                                          onclick="elementAddHandler(this,'entity_team')">
                        </div>
                        <s:if test="entity.relationList !=null">
                            <s:iterator value="entity.relationList" id="element">
                                <s:if test="#element.type==3">
                                    <div><input name="entity_team" type="text"
                                                value="<s:property value="#element.value+':'+#element.key"/>"><input
                                            type="button" value="del" onclick="elementDelHandler(this)"></div>
                                </s:if>
                            </s:iterator>
                        </s:if>
                    </div>
                </td>
                <td vAlign="top">例 青年队：1</td>
            </tr>
            <tr>
                <td vAlign="top">标签</td>
                <td>
                   <input name="entity.tag" value="${entity.tag}"/>
                </td>
                <td></td>
            </tr>

            <tr>
                <td>切块长度：</td>
                <td><input type="text" name="entity.videoPieceLength" value="${entity.videoPieceLength}"></td>
                <td></td>
            </tr>
            <tr>
                <td>音轨语言：</td>
                <td><input type="text" name="entity.audioChannel" value="${entity.audioChannel}"></td>
                <td></td>
            </tr>
            <tr>
                <td>左声道：</td>
                <td><input type="text" name="entity.leftChannel" value="${entity.leftChannel}"></td>
                <td></td>
            </tr>
            <tr>
                <td>右声道：</td>
                <td><input type="text" name="entity.rightChannel" value="${entity.rightChannel}"></td>
                <td></td>
            </tr>
            <tr>
                <td>水印：</td>
                <td><s:radio list="#{'true':'是','false':'否'}" name="entity.waterMarkFlag"
                             value="entity.waterMarkFlag"/></td>
                <td></td>
            </tr>
            <tr>
                <td>弹幕：</td>
                <td><s:radio list="#{'true':'开','false':'关'}" name="entity.allowPopups"
                             value="%{entity.id == 0 ? true:  entity.allowPopups}"/></td>
                <td></td>
            </tr>
            <tr>
                <td vAlign="top">关联点播节目播单：</td>
                <td>
                    <div style="overflow-y:scroll;height:80px;">
                        <div><input name="entity_request_programList" type="text"><input type="button" value="add"
                                                                                         onclick="elementAddHandler(this,'entity_request_programList')">
                        </div>
                        <s:if test="entity.relationList !=null">
                            <s:iterator value="entity.relationList" id="element">
                                <s:if test="#element.type==4">
                                    <div><input name="entity_request_programList" type="text"
                                                value="<s:property value="#element.key"/>"><input
                                            type="button" value="del" onclick="elementDelHandler(this)"></div>
                                </s:if>
                            </s:iterator>
                        </s:if>
                    </div>
                </td>
                <td vAlign="top">例 111</td>
            </tr>
            <tr>
                <td>评论id</td>
                <td><input type="text" name="entity.qitanId" value="${entity.qitanId}"></td>
                <td></td>
            </tr>
            <tr>
                <td>微博话题</td>
                <td><input type="text" name="entity.weiboTopic" value="${entity.weiboTopic}"></td>
                <td></td>
            </tr>
            <tr>
                <td>视频截图</td>
                <td><img src=""></td>
                <td><input type="button" value="上传截图"></td>
            </tr>
        </table>
        <input type="submit" value="保存"/>
    </form>
</div>
</body>
</html>
